#include<iostream>
#include<vector>
#include "QuickSort.h"
#include <string>
#include <fstream>
#include <time.h>
using namespace std;

int main(int args, char* argv[])
{
    time_t start;
    time_t end;
    ifstream file;
    int temp;
    int number = atoi(argv[1]);

    vector<int> target(0);

    cout << "=====================================" << endl;
    cout << "===============median3===============" << endl;
    cout << "=====================================" << endl;
    cout << "median3: " << endl;
    double endtime = 0;
    int count = 0;
    srand(time(0)); 
    while(count++<1000){
	target.clear();
	for(int i=0; i<number; i++){
		file >> temp;
		target.push_back(rand()%(2*number+1)-number);
	}
	file.close();
    	start = clock();
    	sort(target);
    	end = clock();
    	endtime+=(double)(end-start)/CLOCKS_PER_SEC;
    }
    cout << "Time consuming: "<< endtime << endl;

    cout << endl << endl;

    cout << "=====================================" << endl;
    cout << "============randomChoice=============" << endl;
    cout << "=====================================" << endl;
    cout << "randomChoice: " << endl;
    endtime = 0;
    count = 0;
    srand(time(0));
    while(count++<1000){
	target.clear();
	for(int i=0; i<number; ++i){
		file >> temp;
		target.push_back(rand()%(2*number+1)-number);
	}
	file.close();
    	start = clock();
    	sort(target, 0);
    	end = clock();
    	endtime+=(double)(end-start)/CLOCKS_PER_SEC;
    }
    cout << "Time consuming: "<< endtime << endl;



}
